home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: in1.uu.net!tellab5!news
- From: Joe Toth <toth@tellabs.com>
- Subject: Re: Transparent file copy??
- X-Nntp-Posting-Host: sunh25
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <1996Jan30.151917.713@tellab5.tellabs.com>
- Sender: news@tellab5.tellabs.com (News)
- Content-Transfer-Encoding: 7bit
- Organization: Tellabs Operations, Inc.
- References: <Pine.A32.3.91.960129223003.178909A-100000@black.weeg.uiowa.edu>
- Mime-Version: 1.0
- Date: Tue, 30 Jan 1996 15:19:17 GMT
- X-Mailer: Mozilla 1.1 (X11; U; SunOS 4.1.3 sun4c)
- X-Url: news:Pine.A32.3.91.960129223003.178909A-100000@black.weeg.uiowa.edu
-
- The Amorphous Mass <robinson@blue.weeg.uiowa.edu> wrote:
- >On Tue, 30 Jan 1996, Shawn L. Bradley wrote:
- >
- >> How do I transparently copy files from one drive & directory to
- ^^^^ ^^^^^
- >> another in DOS. I don't want to use the system() function because it
- ^^^^^^^
- >> interferes with the windows my app creates. I'm using MSVC++ 1.52.
- >> Any help would be greatly appreciated.
- >
- > You might try the rename() function (in <stdio.h>). It takes as
- ^^^^^^^^
-
- Nope, no way.
- If it works, you no longer have the original..
-
- And it won't always work - see below.
-
- >parameters two strings which are contain the old filename and the new
- >filename and returns non-zero if it fails to rename the file. Note that
- >a "filename" can include a path, so
-
- >
- >rename("C:\\FOO\\BAR.BAT", "C:\\BLECH\\BLORCH\\YUK.BAT");
- >
- >will attempt to rename C:\FOO\BAR.BAT to C:\BLECH\BLORCH\YUK.BAT.
-
- Which fails miserably if you are trying to copy from one file
- system to another (say, hard drive to a floppy)
-
- Try;
-
- rename("C:\\FOO\\BAR.BAT", "A:\\BLECH\\BLORCH\\YUK.BAT");
-
- It will fail...........
-
- If you do intend to move the file from one drive to another, you have
- to 'copy' it first then delete the original. No other way around it.
-
- if you want to do it quickly without using 'system()', you will have
- to write your own code to do it. It's not difficult.
-
- >
- > Of course you can also pass char * or char [] variables to rename() if
- >you want to build the pathnames dynamically.
- >
- >/**James Robinson***********************
- > "An important goal of almost every graphics program is to draw pictures on
- > the screen." -- Neider, Davis & Woo, _OpenGL_Programming_Guide_, Chapter 10
- > *************james-robinson@uiowa.edu**/
-
- --
- _ _ ___ --------------------------+---------------------------------
- | / _ | Joseph G. Toth Jr. | Tellabs Operations, Inc.
- \_| \_/ | | toth@tellabs.com
-
- > Every program has at least one bug and can be shortened by at least
- > one instruction -- from which, by induction, it is evident that every
- > program can be reduced to one instruction that does not work.
- > -- Ken Arnold
-
-